<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>控制语句之分支语句</title>
</head>
<body>
<script>
    /**
     * if else
     * switch case
     */
    var light = "红灯";
    if (light == "红灯") {
        console.log("可以通行")
    } else if (light === "绿灯") {
        console.log("不可以通行")
    } else {
        console.log("稍等通行")
    }

    //个税练习
    var galary = 6500;
    var galary02 = galary - 5000;
    var end;
    if (galary02 <= 1500) {
        end = galary02 * 0.03;
    } else if (galary02 > 1500 && galary02 <= 4500) {
        end = galary02 * 0.1;
    } else if (galary02 > 4500 && galary02 <= 9000) {
        end = galary02 * 0.15;
    } else if (galary02 > 9000 && galary02 <= 35000) {
        end = galary02 * 0.2;
    } else if (galary02 >= 35000 && galary02 < 55000) {
        end = galary02 * 0.25;
    } else if (galary02 >= 55000 && galary02 < 80000) {
        end = galary02 * 0.3;
    } else {
        end = galary02 * 0.45;
    }
    console.log(end);

    var num = 1;
    switch (num) {
        case 1:
            console.log("星期一");
            break;
        case 2:
            console.log("星期二");
            break;
        case 3:
            console.log("星期三")
            break;
        default:
            console.log("周末")
    }
</script>
</body>
</html>